<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>模型列表</title>
	<meta name="renderer" content="webkit">	
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">	
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">	
	<meta name="apple-mobile-web-app-status-bar-style" content="black">	
	<meta name="apple-mobile-web-app-capable" content="yes">	
	<meta name="format-detection" content="telephone=no">	
	<link rel="stylesheet" type="text/css" href="/Public/admin/layui/css/layui.css" media="all">
	<link rel="stylesheet" type="text/css" href="/Public/admin/bootstrap/css/bootstrap.css" media="all">
	<link rel="stylesheet" type="text/css" href="/Public/admin/global.css" media="all">
	<link rel="stylesheet" type="text/css" href="/Public/admin/css/personal.css" media="all">
</head>
<body>
<div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">
  <div class="layui-tab-content">
     <blockquote class="layui-elem-quote mylog-info-tit">
      <ul class="layui-tab-title">
        <a href="/admin/model/add"><li class="layui-btn"><i class="layui-icon"></i>添加模型</li></a>
        <a href="javascript:void(0)" onclick="importshow()"><li class="layui-btn layui-btn-danger"><i class="layui-icon"></i>导入模型</li></a>
      </ul>
    </blockquote>
    <div class="layui-tab-item layui-show">
      <table class="layui-table">
        <colgroup>
          <col width="150">
          <col width="200">
          <col width="150">
          <col>
        </colgroup>
        <thead>
          <tr>
            <th>模型名</th>
            <th>模型附表</th>
            <th>模型描述</th>
            <th>状态</th>
            <th>操作</th>
          </tr>
        </thead>
        <tbody>
          <?php if(is_array($models)): $i = 0; $__LIST__ = $models;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$list): $mod = ($i % 2 );++$i;?><tr>
            <td><?php echo ($list['name']); ?></td>
            <td><?php echo ($list['table']); ?></td>
            <td><?php echo ($list['description']); ?></td>
            <td><?php echo ($list['status']==1?'启用':'<span style="color:red">禁用<span>'); ?></td>
            <td>
              <a href="/admin/model/edit/id/<?php echo ($list['modelid']); ?>" class="layui-btn layui-btn-small layui-btn-danger">修改</a>
              <a href="/admin/field/index/modelid/<?php echo ($list['modelid']); ?>" class="layui-btn layui-btn-small">字段管理</a>
              <a href="/admin/model/del/id/<?php echo ($list['modelid']); ?>" class="layui-btn layui-btn-small layui-btn-danger">删除</a>
              <a href="/admin/model/export/modelid/<?php echo ($list['modelid']); ?>" class="layui-btn layui-btn-small">导出模型</a>
            </td>
          </tr><?php endforeach; endif; else: echo "" ;endif; ?>
        </tbody>
      </table>
    </div>
  </div>
  <div id="importform" style="display: none;">
    <div style="margin: 100px auto; width: 500px; height: 350px;background-color:#FFF;border: 2px solid #000; text-align: center;">
      <h1 style="margin-top: 20px;">导入模型</h1>
      <hr>
      <form class="layui-form" action="/admin/model/import" method="post" enctype="multipart/form-data">
        <div class="layui-form-item">
           <label class="layui-form-label">模型名称：</label>
           <div class="layui-input-inline">
             <input type="text" name="name" placeholder="请输入模型名称" autocomplete="off" class="layui-input">
           </div>
           <div class="layui-form-mid layui-word-aux">为空时按配置文件中的</div>
         </div>
         <div class="layui-form-item">
           <label class="layui-form-label">模型表名：</label>
           <div class="layui-input-inline">
             <input type="text" name="table" placeholder="请输入模型表名" autocomplete="off" class="layui-input">
           </div>
           <div class="layui-form-mid layui-word-aux">为空时按配置文件中的</div>
         </div>
         <div class="layui-form-item">
           <label class="layui-form-label"></label>
           <div class="layui-input-inline">
             <input type="file" name="file">
           </div>
           <div class="layui-form-mid layui-word-aux">只支持.txt文件上传</div>
         </div>
         <div class="layui-form-item">
             <div class="layui-input-inlines">
               <button class="layui-btn" type="submit">提交</button>
               <span>&nbsp;&nbsp;&nbsp;&nbsp;</span>
               <a href="javascript:void(0)" onclick="importhide()"><button type="reset" class="layui-btn layui-btn-primary">关闭</button></a>
             </div>
           </div>
      </form>
    </div>
  </div>
</div>
<script type="text/javascript" src="/Public/admin/layui/layui.js"></script>
<script>
function importshow() {
  document.getElementById('importform').style.cssText='position: fixed; z-index:10; top:0px; left:0px; width: 100%; height: 100%; display: block; background-color: rgba(255,255,255,0.5);';
}
function importhide() {
  document.getElementById('importform').style.cssText='display:none;';
}
</script>
</body>
</html>